Package

Source Code of SimpleBookClient


import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.List;

public class SimpleBookClient {
    public static void main(String args[]) {
        if (System.getSecurityManager() == null) {
         
          System.setProperty("java.security.policy", "wideopen.policy");
            System.setSecurityManager(new SecurityManager());
        }
        try
        {
            String name = "BookServer";
            Registry registry = LocateRegistry.getRegistry("localhost",50000);
            final BookServerInterface comp = (BookServerInterface) registry.lookup(name);

      List<BookDTO> books = comp.listBooks(null,null, null);
     
            for(BookDTO book: books)
            {
              System.err.println(book.getTitle());
            }

        }
        catch (RemoteException e) {
            System.err.println("BookServer exception:");
            e.printStackTrace();
        } catch (NotBoundException e) {
      e.printStackTrace();
    }
    }   
}
TOP

Related Classes of SimpleBookClient

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.